package top.kaoshanji.q1ch02b;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 代码清单-q1ch02b-24页a：使用ApplicationContext
 * @author kaoshanji
 * ^_^
 * create time 2025/5/27 20:40
 */
public class Application {

    private ApplicationContext applicationContext;

    public Application() {
        applicationContext = new ClassPathXmlApplicationContext("q1ch02b/beans.xml");
    }

    public void sayHello() {
        Hello hello = applicationContext.getBean("hello", Hello.class);
        System.out.println(hello.hello());
    }

    public static void main(String[] args) {

        Application application = new Application();
        application.sayHello();

    }

}
